Repository navigation
Fix Expense-Scan expense from Inbox briefly shows Inbox with growl before redirecting to workspace - #103826
Conversation
…fore redirecting to workspace
|
TS check failure not related to my changes, fails on main as well |
|
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4eeb0aa69
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Picking another workspace in the "To" picker moves the transaction to that workspace chat while the route still points | ||
| // at the previous one, so `report` resolves to undefined. Fall back to the picked workspace chat | ||
| // so the destination can still be pre-mounted instead of revealing the Inbox before navigating there. | ||
| const pickedWorkspaceChatReportID = !isUnreported && isPolicyExpenseChatUtils(participantReport) ? participantReport?.reportID : undefined; |
There was a problem hiding this comment.
Resolve the picked workspace from the active receipt
When a global-create scan contains multiple draft receipts and the user advances to a later receipt before changing its To workspace, participantReport is still subscribed from initialTransaction (line 154), while transaction and the picker operate on currentTransactionID. This fallback therefore pre-inserts the first receipt's workspace; the report-preinsert submit path then disables the action's own navigation, so the expenses are written using the active receipt's participant but the user is left in the old workspace. Resolve the fallback report from the active transaction instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed, although I'm not sure if this is not a bug when we submit multiple scan expenses with different recipients and they still end up being added to one of them
There was a problem hiding this comment.
I asked on slack https://swmansion.slack.com/archives/C049HHMV9SM/p1791887575316689
dylanexpensify
left a comment
There was a problem hiding this comment.
Looks good from a product perspective 👍
|
@abdulrahuman5196 in case you missed it |
|
Hi, Will check on thi |
| const pickedParticipant = transaction?.participants?.at(0); | ||
| const pickedWorkspaceChatReportID = !isUnreported && isPolicyExpenseChat(pickedParticipant) ? pickedParticipant?.reportID : undefined; |
There was a problem hiding this comment.
Duplicate "first participant" variable
pickedParticipant reads transaction?.participants?.at(0), but the hook already has firstParticipant = participants.at(0) a few lines below.
participants maps transaction.participants one to one and keeps reportID and isPolicyExpenseChat, so both hold the same participant under different names.
Move firstParticipant above this block and use isPolicyExpenseChat(firstParticipant) ? firstParticipant?.reportID : undefined.
| // Picking another workspace in the "To" picker moves the transaction to that workspace chat while the route still points | ||
| // at the previous one, so `report` resolves to undefined. Fall back to the picked workspace chat | ||
| // so the destination can still be pre-mounted instead of revealing the Inbox before navigating there. | ||
| const isUnreported = transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID; |
There was a problem hiding this comment.
isUnreported computed twice
The page already computes the same value and passes it to the orchestrator.
The hook takes the page's other flags as params.
Add isUnreported to UseSubmitDestinationPreMountParams and pass it from the page.
| // Picking another workspace in the "To" picker moves the transaction to that workspace chat while the route still points | ||
| // at the previous one, so `report` resolves to undefined. Fall back to the picked workspace chat | ||
| // so the destination can still be pre-mounted instead of revealing the Inbox before navigating there. | ||
| const isUnreported = transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID; | ||
| const pickedParticipant = transaction?.participants?.at(0); | ||
| const pickedWorkspaceChatReportID = !isUnreported && isPolicyExpenseChat(pickedParticipant) ? pickedParticipant?.reportID : undefined; |
There was a problem hiding this comment.
Unreported guard has no reason
The comment explains the fallback but not why unreported expenses are skipped.
Categorizing a tracked expense into a new draft workspace leaves it unreported with a workspace chat participant, so the guard reads like a bug.
Add one sentence on where an unreported expense lands and why the participant's chat is the wrong destination for it.
| it('pre-mounts the workspace chat picked on the receipt being viewed when there are multiple receipts', async () => { | ||
| // Given a global create with two receipts, where the first one is still on the default workspace chat the route | ||
| // was seeded with and the "To" picker moved only the second one to another workspace chat. The picker writes to the | ||
| // receipt being viewed, so the route's (first) transaction no longer reflects where the expenses are submitted. |
There was a problem hiding this comment.
Multi-receipt test sets up an unreachable state
The Given says the "To" picker moved only the second receipt.
The picker writes the pick to every receipt in the batch, so receipts on different workspaces can't happen in the app.
App/src/hooks/useConfirmationParticipantSelection.ts
Lines 91 to 94 in e27643d
Seed both drafts with the picked chat, or reword the Given.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.mp4iOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
situchan
left a comment
There was a problem hiding this comment.
Looks good.
Left some nab comments
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #102858 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
roryabraham
left a comment
There was a problem hiding this comment.
agree @situchan's comments are NAB
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.34-0 🚀
|
|
No FullStory changes needed — this PR only fixes navigation after selecting a different workspace for an expense, preventing a brief Inbox flash without adding new UI, screens, or user properties. |
|
No help site update needed — this PR fixes a brief navigation flicker after creating an expense, restoring expected behavior without adding a feature or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.34-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Picking another workspace in the confirmation "To" picker left
reportundefined because the route still pointed at the old workspace chat. With nodestinationReportID, the chat was not pre-mounted and submit took the DEFAULT path, briefly showing the Inbox.IOURequestStepConfirmationnow falls back to the picked workspace chat, so it is pre-inserted and revealed directly.Fixed Issues
$ #102858
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-10-13.at.08.25.22.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-10-13.at.08.53.42.mov
iOS: mWeb Safari
MacOS: Chrome / Safari